package com.foruo.learn.designmode.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * 店面
 * @author GaoYuan
 * @date 2018/11/11 上午8:53
 */
public class Shop {

    private List<Goods> goodsList = new ArrayList<>();

    /** 添加 */
    public void add(Goods goods){
        goodsList.add(goods);
    }

    /** 商家询问顾客看中哪件 */
    public void askAnswer(Visitor visitor){
        for(Goods goods:goodsList){
            // 商品挨个接收访问者访问
            goods.accept(visitor);
        }
    }

}
